package com.briup.server.task;

import com.briup.server.service.RentalInfosService;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 自动审核预约信息的任务类
 */
@Component
@RequiredArgsConstructor
public class AutoApprovalRentalTask {

    private final RentalInfosService service;

    /**
     * 每隔5分钟，调用autoApproval方法，自动审批
     */
    @Scheduled(cron = "0 */5 * * * *")
    public void auto() {
        service.autoApproval();
        System.out.println("自动审核预约信息任务执行");
    }
}
